#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
void* my_memmve(void* dst,void* src,size_t num)
{
	void* ret = dst;
	if (dst <= ret)
	{
		while (num--)
		{
			*(char*)dst = *(char*)src;
			src=(char*)src+1;
			dst=(char*)dst+1;
		}
	}
	else
	{
		dst = (char*)dst + num - 1;
		src = (char*)src + num - 1;

		while (num--)
		{
			*(char*)dst = *(char*)src;
			dst = (char*)dst - 1;
			src = (char*)src - 1;
		}
	}
	return (void*)ret;
}
int main()
{
	int arr1[] = { 1,2,3,4,5,6,7,8,9,10 };
	int arr2[] = { 1,2,3,4,5,6,7,8,9,10 };
	memmove(arr1 + 2, arr1, 20);
	my_memmve(arr2 + 2, arr2, 20);
	for (int i = 0; i < sizeof(arr1) / sizeof(arr1[0]); i++)
	{
		printf("%d ", arr1[i]);
		//printf("%d ", arr2[i]);
	}
	printf("\n");
	for (int i = 0; i < sizeof(arr1) / sizeof(arr1[0]); i++)
	{
		//printf("%d ", arr1[i]);
		printf("%d ", arr2[i]);
	}
	return 0;
}